package com.itheima.d2_buffered_stream;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.Writer;

/**
 * 目标：掌握字符缓冲输出流的用法。
 * //BufferedWriter
 * 功能：write方法和FileWriter的用法一样
 * 特有功能：换行
 * newLine()
 */
public class Test3BufferedWriter {
    public static void main(String[] args) {
        try (
             BufferedWriter bw = new BufferedWriter(new FileWriter("day10io-app2/file/File03.txt",true))
        ) {
            bw.write("    静夜思     ");
            bw.newLine();
            bw.write("窗前明月光");
            bw.newLine();
            bw.write("窗前明月光");
            bw.newLine();
            bw.write("窗前明月光");
            bw.newLine();
            bw.write("窗前明月光");
            bw.newLine();
            //自动释放资源
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
